package com.isoft.service.tableservice;

import com.isoft.dao.tabledao.DfmeDepeDao;
import com.isoft.entity.tableentity.dfme_depe.DfmeDepeMsg;
import com.isoft.utils.TimeFormatUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.text.ParseException;

@Service
@Slf4j
public class DfmeDepeService {
    @Autowired
    DfmeDepeDao dfmeDepeDao;
    public int insertmsg(DfmeDepeMsg dfmeDepeMsg) throws ParseException {
        Timestamp create_time = new Timestamp(System.currentTimeMillis());
        Timestamp frtt= TimeFormatUtils.stringToTimestamp(dfmeDepeMsg.getDfmeDepeDflt().getFatt());
        dfmeDepeDao.insertMeta(create_time,dfmeDepeMsg.getDfmeDepeMeta());
        return dfmeDepeDao.insertDflt(dfmeDepeMsg.getDfmeDepeMeta().getSeqn(),create_time,frtt,dfmeDepeMsg.getDfmeDepeDflt());
    }
}
